<?php

namespace app\common\validate;

use think\Validate;

class Upload extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名'	=>	['规则1','规则2'...]
     *
     * @var array     //上传3M = 3145728 B
     */	
	protected $rule = [
        'image' => 'require|fileExt:jpeg,jpg,png,bmp|fileMime:image/jpg,image/jpeg,image/png,image/bmp|fileSize:3145728'
        //'image' => 'require|fileExt:jpeg,jpg,png,gif,bmp|fileMime:image/jpg,image/jpeg,image/png,image/gif,image/bmp|fileSize:3145728'
    ];
    
    /**
     * 定义错误信息
     * 格式：'字段名.规则名'	=>	'错误信息'
     *
     * @var array
     */	
    protected $message = [
//        '__token__.token'=>'请勿重复提交数据',
//        'auth.require'=>'请勾选权限',
        'image.require'=>'请上传图片',
        'image.fileExt'=>'请上传后缀为[jpeg,jpg,png,gif,bmp]的图片',
        'image.fileMime'=>'图片类型格式错误',
        'image.fileSize'=>'请上传小于3M的图片'
    ];
}